Skip to content

webapi-test 0.4.0.0: a scenario's moves, the prediction, a move judged against what the host observes (zenbridge #2714) - #52

Merged
mageshb merged 4 commits into
masterfrom
feature/2714-scenario-language
Nov 16, 2026
Merged

mageshb merged 4 commits into
masterfrom
feature/2714-scenario-language

Conversation

@mageshb

@mageshb mageshb commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Zenbridge #2714 (Preflight 3, the scenario language): the generic engine half.

  • Test.WebApi.Moves — a move as one unit: things picked by the stage they are predicted at (pickAt), a step that begins it and one that settles it; anyMoves n draws moves by weight among those allowed (quickcheck-dynamic's weighted choice); narrowing keeps or drops whole moves.
  • Test.WebApi.Prediction — things, tracks (stages, refusals, answers with conditions), the stage a thing is predicted at as a class; after a move settles, a Judge holds the prediction against what the host observes (MoveHost: settle within a budget, observe, its own checks). A move that does not settle is inconclusive: the case is discarded and the trace says so.
  • EffectCall runs in the sessions (breaking): a host's own step may call the apps.
  • A fresh value is new each time it is drawn (FreshValue begins its own step).
  • The trace records begin/settle steps, a step's move, a check's subject, the inconclusive outcome.

Test: moves (a toy platform, 15 checks). Integrated and run on a sandbox from zenbridge.

🤖 Generated with Claude Code

https://claude.ai/code/session_011wn1pGkP2oCTsWbhEafdF2

mageshb and others added 4 commits November 16, 2026 19:27
…t, and moves judged against what the host observes (0.4.0.0, zenbridge #2714)

A scenario's moves, generic, for the scenario language of zenbridge
#2714 (Test.WebApi.Moves, Test.WebApi.Prediction):

* A move is written as DL: its things picked by the stage they are
  predicted at (pickAt), a step that begins it (MoveBegin), its own
  steps, and a step that ends it (MoveSettle). anyMoves n draws moves
  one after another, n on average, each by its weight among the moves
  allowed at that point: quickcheck-dynamic's own weighted choice. Each
  draw opens with a pick of nothing, so that past a case's size the
  generator stops instead of running on to the step limit.
* ApiState gains the prediction: the things a scenario tracks, each with
  its track, predicted stage, the moves made on it, the labels its draws
  gave and its value. A Track declares the stages, the refusal stages and
  the platform's answers; the first answer whose when holds is taken. A
  thing at a stage is also recorded under the class track@stage.
* A move's end: the host settles what the move caused within the move's
  budget and observes it (MoveHost, WebApiGlobalStateModel.appMoveHost;
  defMoveHost settles at once). The property's Judge holds every thing
  against the observation (its observed stage, the checks at its stage,
  the checks after the move, the checks across things), and the host's
  own checks run. A failure names the check and the thing.
* A move that does not settle, or cannot be observed, is inconclusive:
  its case stops and QuickCheck discards it; the trace says why.
* Narrowing goes through the program (narrowThroughProgram, for propDL
  and propDLTraced). quickcheck-dynamic keeps a shorter case's own steps,
  checked against the program only by Eq (a call's operation and label),
  so a step under a narrowed pick kept the request it was drawn with.
  Each shorter case is now made again from its picks, as a regression
  case is replayed; every pick is offered narrowed (quickcheck-dynamic
  narrows a run of picks only from its first); a move is kept or dropped
  whole.
* The trace: step kinds begin and settle, StepRecord.inMove and
  .inconclusive, CheckRecord.subject, CaseOutcome Inconclusive,
  ReplayOutcome ReplayInconclusive; a case's moves and the move counts
  list a scenario's moves rather than their steps.
* AnyVal moves to Test.WebApi.Val (re-exported as before).
* A test suite, moves: two moves against a toy platform that does not
  acknowledge a replacement 850 (narrowed to two whole moves, the failure
  named, replayed to the same failure, passing once fixed; inconclusive
  when nothing settles).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011wn1pGkP2oCTsWbhEafdF2
…ridge #2714)

Move.body gives a MoveBody { values, labels, uses }: the values of the
things it makes, the labels its draws said, and the variables those
values refer to beyond their own (a value the engine cannot look into,
a host's Dhall value, say). The settle step keeps them (MoveEnd.uses),
so narrowing never keeps a move whose things refer to a step it
dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011wn1pGkP2oCTsWbhEafdF2
A host's own step — a partner's document drawn from its spec, enveloped
and uploaded — makes several calls as the run's context, so the effect is
LookUp -> WebApiSessions apps (Either Text res), was IO. An IO effect
lifts with liftIO (the moves suite's toy platform does).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011wn1pGkP2oCTsWbhEafdF2
…714)

FreshValue begins a step of its own, so the session's one-token-per-label-
per-step cache no longer hands a second draw of the same label the first
draw's token. Found on a sandbox: two orders a scenario's move made in one
case had one "fresh" PO, and the platform saw the second order as the
first one's replacement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011wn1pGkP2oCTsWbhEafdF2
@mageshb
mageshb merged commit 729e05d into master Nov 16, 2026
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant